﻿using MediatR;
using T.Basic.Domain.T.Basic.Model;
using T.Basic.Read.API.Appliction.Command.LineCommand;
using T.Basic.Repository.BasicInterface;

namespace T.Basic.Read.API.Appliction.CommandHandlers.LineHanders
{
    /// <summary>
    /// 根据线路名称显示数据
    /// </summary>
    public class LineGetByCommandHandler : IRequestHandler<LineGetByCommand, List<Line>>
    {
        private readonly ILineRepository _lineRepository;
        public LineGetByCommandHandler(ILineRepository lineRepository)
        {
            _lineRepository = lineRepository;
        }
        public async Task<List<Line>> Handle(LineGetByCommand request, CancellationToken cancellationToken)
        {
            return await _lineRepository.GetAsync(d => d.LineName == request.LineName);
        }
    }
}
